import { createRouter,createWebHistory } from 'vue-router'
//
const home = () => import('../views/home/Home');
const category = () => import('../views/category/Category');
const shoppingCart = () => import('../views/shoppingCart/Shopping');
const mine = () => import('../views/mine/Mine');
const Detail = () => import('../views/detail/Detail');

const routes = [
  {
    "path": '/',
    "redirect":"/home",
  },
  {
    "path": "/home",
    "component": home,
    "meta": {
      "title": "首页"
    }
  },
  {
    "path": "/category",
    "component": category,
    "meta": {
      "title": "分类"
    }
  },
  {
    "path": "/shoppingCart",
    "component": shoppingCart,
    "meta": {
      "title": "购物车"
    }
  },
  {
    "path": "/mine",
    "component": mine,
    "meta": {
      "title": "我的"
    }
  },
  {
    "path": "/detail/:iid",
    "component": Detail,
    "meta": {
      "title": "详情页"
    }
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
  mode:"history",
})

export default router
